
<?php
require 'src/facebook.php';  // Include facebook SDK file
$facebook = new Facebook(array(
  'appId'  => '700715950012686',   // Facebook App ID 
  'secret' => 'a33a75e4bafc2b72b52e12d49a49a594',  // Facebook App Secret
  'cookie' => true,    
));

$user = $facebook->getUser();
if ($user) {
  try {
    $user_profile = $facebook->api('/me');
          $fbid = $user_profile['id'];           // To Get Facebook ID
         $fbuname = $user_profile['username'];  // To Get Facebook Username
         $fbfullname = $user_profile['name'];    // To Get Facebook full name
  } catch (FacebookApiException $e) {
    error_log($e);
   $user = null;
  }
}


if ($user) {
 // $logoutUrl = $facebook->getLogoutUrl(array(
 //        'next' => 'http://demos.krizna.com/1353/logout.php',  // Logout URL full path
  //      ));
  echo "ok";
} else {
// $loginUrl = $facebook->getLoginUrl(array(
 //       'scope'        => 'email', // Permissions to request from the user
 //       ));
	echo "fail";
}
?>
